/**
 * Writed by yura and mak
 */

package wz.legend;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import org.apache.http.impl.io.AbstractSessionInputBuffer;
import org.apache.http.params.HttpParams;

public class ByteArraySessionInputBuffer extends AbstractSessionInputBuffer {
    
    private int bufferpos;
    private int bufferlen;
    
    public ByteArraySessionInputBuffer(final byte[] buffer,
            final HttpParams params) {
        super();
        bufferpos = 0;
        bufferlen = buffer.length;
        init(new ByteArrayInputStream(buffer), bufferlen, params);
    }

    public boolean isDataAvailable(int timeout) throws IOException {
        return this.bufferpos < this.bufferlen;
    }

}
